Skip to content

feat(compliance): PR 3 — StoreFullInputs sidecar payloads file#3

Merged
OpsKern merged 1 commit into
mainfrom
pr/store-full-inputs
May 6, 2026
Merged

feat(compliance): PR 3 — StoreFullInputs sidecar payloads file#3
OpsKern merged 1 commit into
mainfrom
pr/store-full-inputs

Conversation

@OpsKern
Copy link
Copy Markdown
Contributor

@OpsKern OpsKern commented May 5, 2026

Summary

  • Adds Config.StoreFullInputs bool (default false) — opt-in to store raw input/output JSON alongside the Merkle chain
  • When enabled, creates a sidecar JSONL file at AuditPath+".payloads" (mode 0600) containing payloadEntry records keyed by audit_id
  • Messages.New writes full params + resp JSON after each allowed LLM call
  • Messages.NewStreaming writes params JSON at stream start
  • Audit() writes event.Metadata as the input payload when non-empty
  • PayloadsPath() string exposes the sidecar path for operators/tooling
  • AuditStore interface is unchanged — no breaking changes

EU AI Act Article 12

Closes the Granularity PARTIAL item: auditors can now replay exactly what the agent sent and received. StoreFullInputs is opt-in to respect deployments where storing raw LLM payloads is a privacy concern.

Test plan

  • TestStoreFullInputsCreatesPayloadsFile — file created with mode 0600, PayloadsPath() correct
  • TestStoreFullInputsDisabledNoFile — no file when StoreFullInputs=false
  • TestStoreFullInputsAuditWritesPayload — Audit() with metadata writes payload entry
  • go test -race ./... PASS
  • gosec ./... 0 issues (3 nosec: G304 on construction-time paths)
  • govulncheck ./... clean

🤖 Generated with Claude Code

Add opt-in Config.StoreFullInputs that writes raw input/output JSON to
a sidecar JSONL file at AuditPath+".payloads". The main chain and
AuditStore interface are unchanged.

- payloadWriter appends payloadEntry records (audit_id, timestamp,
  event_type, input, output) to the sidecar file, mode 0600 enforced
- Messages.New writes full params+response after each allowed LLM call
- Messages.NewStreaming writes params at stream start
- Audit() writes event.Metadata as input payload when non-empty
- PayloadsPath() exposes the sidecar path for operators
- StoreFullInputs=false (default) creates no sidecar file and adds
  zero overhead to the hot path

Enables EU AI Act Article 12 auditors to replay exactly what the agent
sent and received without changing the tamper-evident chain format.

gosec: 0 issues (3 nosec); go test -race: PASS; govulncheck: clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@OpsKern OpsKern force-pushed the pr/store-full-inputs branch from 97facb9 to c3542f9 Compare May 6, 2026 02:15
@OpsKern OpsKern merged commit 5d367b4 into main May 6, 2026
1 check passed
@OpsKern OpsKern deleted the pr/store-full-inputs branch May 6, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant